from django.shortcuts import render, HttpResponse
# Create your views here.
# 在URL中携带参数
# 1.通过查询字符串（query string）:https://www.baidu.com/?wd=python/&pn=1&ps=20
# 2.在path中携带参数:https://127.0.0.1:8000/book/1
# 1.查询字符串:http://127.0.0.1:8000/book?id=3&name=xx
def book_detail_query_string(request):
    # request.GET={'id': '3'}
    name = request.GET.get('name')
    book_id = request.GET.get('id')
    return HttpResponse(f'查询字符串为:{book_id},查询名字为:{name}')
def book_detail_path(request,book_id): # 2.在path中携带参数
    return HttpResponse(f'path中携带参数为:{book_id}')    # 3.在path中携带多个参数
def book_str(request,book_id):
    return HttpResponse(f'path中携带多个参数为:{book_id}')
def book_slug(request,book_id):
    return HttpResponse(f'path中携带多个参数为:{book_id}')
def book_path(request,book_id):
    return HttpResponse(f'path中携带多个参数为:{book_id}')



